/**
 * Created by Administrator on 2016/7/20.
 */
angular.module('app.controllers', ['ui.bootstrap'])
    
    .controller('PublicCtrl', function ($scope, Data) {
        $scope.data = {};
        $scope.data.tabs = Data.tabs;
        new WOW().init();

    })

    //会员管理控制器
    .controller('HomepageCtrl', function($scope, Data, $timeout){
        $scope.data = {};
        $scope.data.tabs = Data.tabs;
        $scope.nowUrl = '#/homepage';
        $scope.data.dataList = [
            {
                id:1,
                path:'./images/carousel-1.jpg'
            },
            {
                id:2,
                path:'./images/carousel-2.jpg'
            }
        ];

        $scope.data.dataList2 = [
            {
                path: './images/price-1.jpg',
                title: '简餐便当',
                price: 5900,
                delay: 0.2
            },
            {
                path: './images/price-2.jpg',
                title: '简餐便当',
                price: 5900,
                delay: 0.4
            },
            {
                path: './images/price-3.jpg',
                title: '简餐便当',
                price: 5900,
                delay: 0.6
            },
            {
                path: './images/price-4.jpg',
                title: '美味小吃',
                price: 5900,
                delay: 0.8
            },
            {
                path: './images/price-5.jpg',
                title: '美味小吃',
                price: 5900,
                delay: 1
            }
        ];

        $timeout(function(){
            var mySwiper = new Swiper('.swiper-container', {
                //loop:true,  //循环
                slideToClickedSlide:true,
                prevButton:'.swiper-button-prev1',
                nextButton:'.swiper-button-next1',
                loop: true,
                // pagination : '.swiper-pagination',
                paginationClickable:true,
                // slidesPerView: 4,
                // spaceBetween:20,
                // slidesPerGroup : 4,
                speed:800
            });
            var mySwiper = new Swiper(".swiper-container2", {
                slideToClickedSlide:true,
                prevButton:'.swiper-prve',
                nextButton:'.swiper-next',
                // loop: true,

                // pagination : '.swiper-pagination',
                paginationClickable:true,
                slidesPerView: 4,
                spaceBetween:5,
                // slidesPerGroup : 4,
                speed:800
            })

        },10)
    })

    //活动管理控制器
    .controller('CompanyInfoCtrl', function($scope, Data){
        $scope.data = {};
        $scope.data.tabs = Data.tabs;
        $scope.nowUrl = '#/companyinfo';




    })

    //活动管理详情
    .controller('ActivityDetailCtrl', function($scope){
        $scope.data = {};
    })

    //历史活动控制器
    .controller('ProductionsCtrl', function($scope, Data){
        $scope.data = {};
        $scope.data.tabs = Data.tabs;
        $scope.nowUrl = '#/productions';

    })

    //创建活动控制器
    .controller('CompanyAddressCtrl', function($scope, Data){
        $scope.data = {};
        $scope.data.tabs = Data.tabs;
        $scope.nowUrl = '#/companyaddress';

        var map = new BMap.Map("address");          // 创建地图实例
        map.centerAndZoom(new BMap.Point(113.3345211, 23.10229), 15); // 初始化地图，设置中心点坐标和地图级别
        var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
        var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
        map.addControl(new BMap.MapTypeControl({
            mapTypes:[
                BMAP_NORMAL_MAP,
                BMAP_HYBRID_MAP
            ]}));
        map.addControl(top_left_control);
        map.addControl(top_left_navigation);
        map.setCurrentCity('北京');
        map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放



    })

    //消息中心控制器
    .controller('MessageCenterCtrl', function($scope, Data){
        $scope.data = {};
        $scope.data.tabs = Data.tabs;
        $scope.nowUrl = '#/messagecenter';

    })
;
